﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Painel.Master" AutoEventWireup="true" CodeBehind="frmNoticias.aspx.cs" Inherits="Site_CamaraTibau.frmNoticias" %>

<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">




  <asp:UpdatePanel ID="updPanel" runat="server">
        <ContentTemplate>
        

        <br clear="all" />

        <div align="center">
            <div class="alert-message error">
                <asp:Label ID="lblErro" runat="server" Font-Bold="True"></asp:Label>
            </div>
            <div class="alert-message success">
                <asp:Label ID="lblSucesso" runat="server" Font-Bold="True" ></asp:Label>
            </div>
        </div>

        <div class="SubPagina_Painel">

            <h3>
                Notícias - <asp:Label ID="lblHeader" runat="server" Text=""></asp:Label>
            </h3>

            <br clear="all" />

            <asp:MultiView ID="mtv" runat="server">
                 
                <asp:View ID="viewListagem" runat="server" onactivate="viewListagem_Activate"  >
                    <asp:Panel ID="pnlListagem" runat="server" >
                        
                        <div style="float: left; height: auto; width:100%;">
                            <div  style="float: left; height: auto; margin-right:10px;"> 
                                <asp:Label ID="Label3" runat="server" AssociatedControlID="txtPesquisarID" Width="100px" Text="ID:" CssClass="lbl" /></br>
                                <asp:TextBox ID="txtPesquisarID" runat="server" CssClass="textBox" Width="60px"></asp:TextBox>
                            </div>
                              <div  style="float: left; height: auto; margin-right:10px;"> 
                                <asp:Label ID="Label5" runat="server" AssociatedControlID="txtPesquisarTitulo" Width="120px" Text="Titulo:" CssClass="lbl" /><br />
                                <asp:TextBox ID="txtPesquisarTitulo" runat="server" CssClass="textBox" Width="320px"></asp:TextBox>
                            </div>
                        </div>



                          <br clear="all" />

                                <div style="float: left; height: auto;  margin:10px 0px 10px 0px; width:100%; ">

                                    <div style="float:left; height:auto; margin-bottom:0px; width:50%;">
                                        <asp:Button ID="btnPesquisar" runat="server" Text="Pesquisar" CssClass="btn primary" onclick="btnPesquisar_Click" />
                                    </div>
                                    <div style="float:left; height:auto; margin-bottom:0px; width:50%; text-align:right;">
                                        <asp:Button ID="btnNovo" runat="server" Text="Cadastrar Notícia" CssClass="btn info" onclick="btnNovo_Click"  />
                                    </div>
                                </div>


                        <br clear="all" />

                        <div style="float: left; height: auto;  width:100%;">
                            <h3><asp:Label ID="lblNumeroLinhas" runat="server" Text=""></asp:Label></h3>
                        </div>

                        <br clear="all" />

                        <div style="float: left; height: auto; margin: 0px 0px 20px 0px; width:100%; ">
                            <asp:GridView ID="gvListagem" 
                                runat="server" 
                                AutoGenerateColumns="false"
                                CellPadding="2" 
                                ForeColor="#333333" 
                                GridLines="None"
                                AllowPaging="true"
                                PageSize="10"
                                ShowFooter="false"
                                EmptyDataText="Nenhum Partido foi localizado!"
                                OnRowCreated="gvListagem_RowCreated"
                                OnRowCommand="gvListagem_RowCommand"
                                OnPageIndexChanging="gvListagem_PageIndexChanging"
                                Width="100%"
                                >
                                <Columns>
                                <asp:TemplateField HeaderText="ID">
                                    <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" Width="60px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblID" runat="server" Text='<%# Eval("ID") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>


                                <asp:TemplateField HeaderText="Dt. Publicação" >
                                    <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle"  Width="200px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lbldtPublicacao" runat="server" Text='<%# Eval("dtPublicacao") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Titulo">
                                    <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblTitulo" runat="server" Text='<%# Eval("Titulo") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                    <asp:TemplateField>
                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle"/>
                                        <ItemTemplate>
                                            <asp:ImageButton ID="btnEditar" Text="Editar" runat="server" CausesValidation="false"
                                            CommandName="cmdEditar" CommandArgument='<%# Eval("ID")  %>' 
                                            ImageUrl="~/img/icon_edit.png" ToolTip='<%# String.Concat("Editar: ", Eval("Titulo")) %>' />
                                        </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField>
                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="20px" />
                                        <ItemTemplate>
                                            <asp:ImageButton ID="btnExcluir" Text="Excluir" runat="server" CausesValidation="false"
                                            CommandName="cmdExcluir" CommandArgument='<%# Eval("ID")  %>' 
                                            ImageUrl="~/img/icon_remove.png" ToolTip='<%# String.Concat("Excluir: ", Eval("Titulo")) %>' OnClientClick="javascript:return confirm('Deseja realmente excluir este registro ?');" />
                                        </ItemTemplate>
                                </asp:TemplateField>
                                </Columns>
                                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                <EditRowStyle BackColor="#999999" />
                                <FooterStyle BackColor="#284775" Font-Bold="True" ForeColor="White" />
                                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" HorizontalAlign="Left" />
                                <PagerStyle BackColor="#5D7B9D" ForeColor="White" HorizontalAlign="Center" />
                                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                            </asp:GridView>
                            
                        </div>

                    </asp:Panel>
                </asp:View>


                <asp:View ID="viewFormulario" runat="server" onactivate="viewFormulario_Activate" >
                    <asp:Panel ID="pnlFormulario" runat="server" DefaultButton="btnSalvar">

                        <div style="float: left; height: auto; width:100%; margin:0px 0px 10px 0px;">
                            <div  style="float: left; height: auto; margin-right:20px;"> 
                                <asp:Label ID="Label11" runat="server" AssociatedControlID="lblID" Width="60px" Text="ID:" CssClass="lbl" />
                                <asp:Label ID="lblID" runat="server" Text="" Width="60px"></asp:Label>
                            </div>
                        </div>
                        

                        <br clear="all" />

                        <div style="float: left; height: auto; width:100%; margin-top:10px;">
                             <div  style="float: left; height: auto; margin-right:10px;"> 
                                <asp:Label ID="Label7" runat="server" AssociatedControlID="ddlCategoria" Width="100px" Text="Categoria:" CssClass="lbl" /><br />
                                 <asp:DropDownList ID="ddlCategoria" runat="server" CssClass="ddList">
                                 </asp:DropDownList>
                            </div>
                        </div>

                        <br clear="all" />

                        <div style="float: left; height: auto; width:100%; margin-top:10px;">
                             <div  style="float: left; height: auto; margin-right:10px;"> 
                                <asp:Label ID="Label1" runat="server" AssociatedControlID="txtTitulo" Width="100px" Text="Título:" CssClass="lbl" /><br />
                                <asp:TextBox ID="txtTitulo" runat="server" CssClass="textBox" Width="620px" MaxLength="130"></asp:TextBox>
                            </div>
                        </div>

                        <br clear="all" />

                        <div style="float: left; height: auto; width:100%; margin-top:10px;">
                             <div  style="float: left; height: auto; margin-right:10px;"> 
                                <asp:Label ID="Label8" runat="server" AssociatedControlID="txtResumo" Width="100px" Text="Resumo:" CssClass="lbl" /><br />
                                <asp:TextBox ID="txtResumo" runat="server" CssClass="textBox" Width="900px"  MaxLength="220" ></asp:TextBox>
                            </div>
                        </div>


                        <br clear="all" />

                        <div style="float: left; height: auto; width:100%; margin-top:10px;">
                             <div  style="float: left; height: auto; margin-right:10px;"> 
                                <asp:Label ID="Label4" runat="server" AssociatedControlID="CKEditor1" Width="100px" Text="Texto da Notícia:" CssClass="lbl" /><br />
                                

                                <CKEditor:CKEditorControl ID="CKEditor1" BasePath="~/ckeditor/" runat="server" Width="99%" Height="600px"></CKEditor:CKEditorControl>
                            </div>
                        </div>

                        <br clear="all" />

                        <div style="float: left; height: auto; width:100%; margin:20px 0px 0px 0px;">
                            <h4>VEREADORES ENVOLVIDOS</h4>
                            <hr /></br>
                            <div  style="float: left; height: auto; margin-right:10px;"> 
                                 <asp:Label ID="Label2" runat="server" AssociatedControlID="ddlVereador" Width="100px" Text="Vereador:" CssClass="lbl" /><br />
                                 <asp:DropDownList ID="ddlVereador" runat="server" CssClass="ddList"> </asp:DropDownList>
                            </div>

                            <div  style="float: left; height: auto; margin:12px 0px 0px 10px;"> 
                                <asp:Button ID="btnADDVereador" runat="server" Text="Adicionar Vereador" CssClass="btn primary" onclick="btnADDVereador_Click"  />
                            </div>
 

                        </div>

                          <div style="float: left; height: auto; width:100%; margin: 20px 0px 20px 0px;">
                            <div style="float: left; height: auto; margin: 0px 0px 20px 0px; width:100%; ">
                            <asp:GridView ID="gvVereadores" 
                                runat="server" 
                                AutoGenerateColumns="false"
                                CellPadding="2" 
                                ForeColor="#333333" 
                                GridLines="None"
                                AllowPaging="true"
                                PageSize="10"
                                ShowFooter="false"
                                EmptyDataText="Nenhum Vereador foi vinculado a esta Notícia!"
                                OnRowCreated="gvVereadores_RowCreated"
                                OnRowCommand="gvVereadores_RowCommand"
                                OnPageIndexChanging="gvVereadores_PageIndexChanging"
                                Width="100%"
                                >
                                <Columns>
                                <asp:TemplateField HeaderText="ID">
                                    <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" Width="60px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblID" runat="server" Text='<%# Eval("ID") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>


                                <asp:TemplateField HeaderText="Vereador" >
                                    <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle"  Width="200px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblNome" runat="server" Text='<%# Eval("Nome") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Titulo">
                                    <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblTitulo" runat="server" Text='<%# Eval("Nome") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField>
                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="20px" />
                                        <ItemTemplate>
                                            <asp:ImageButton ID="btnExcluir" Text="Excluir" runat="server" CausesValidation="false"
                                            CommandName="cmdExcluir" CommandArgument='<%# Eval("ID")  %>' 
                                            ImageUrl="~/img/icon_remove.png" ToolTip='<%# String.Concat("Excluir: ", Eval("Nome")) %>' OnClientClick="javascript:return confirm('Deseja realmente excluir este registro ?');" />
                                        </ItemTemplate>
                                </asp:TemplateField>
                                </Columns>
                                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                <EditRowStyle BackColor="#999999" />
                                <FooterStyle BackColor="#284775" Font-Bold="True" ForeColor="White" />
                                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" HorizontalAlign="Left" />
                                <PagerStyle BackColor="#5D7B9D" ForeColor="White" HorizontalAlign="Center" />
                                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                            </asp:GridView>
                            </div>
                        </div>

                        <br clear="all" />

                        <div style="float: left; height: auto; width:100%; margin:20px 0px 0px 0px;">
                            <h4>FOTOS (Proporção 2,075:1 [x=(y*2,075);y=(x/2,075)])</h4>
                            <hr /></br>
                            <div style="float: left; height: auto; width:100%; margin:0px 0px 0px 0px;">
                                <asp:Label ID="lblArquivoFoto" runat="server" AssociatedControlID="FileUpload1" Width="100px" Text="Arquivo:" CssClass="lbl" />
                                <asp:FileUpload ID="FileUpload1" runat="server" />
                            </div>

                            <div style="float: left; height: auto; width:100%;">
                                 <div  style="float: left; height: auto; margin-right:10px;"> 
                                    <asp:Label ID="Label6" runat="server" AssociatedControlID="txtFotoDescricao" Width="100px" Text="Descrição da Foto:" CssClass="lbl" />
                                    <asp:TextBox ID="txtFotoDescricao" runat="server" CssClass="textBox" Width="550px"></asp:TextBox>
                                </div>
                                <div  style="float: left; height: auto; margin:0px 0px 0px 10px;"> 
                                    <asp:Button ID="btnADDFoto" runat="server" Text="Adicionar Foto" CssClass="btn primary" OnClick="btnADDFoto_Click" />
                                </div>
                            </div>
                            <br clear="all" />
                            <br clear="all" />
                            <div  style="float: left; height: auto; width: 100%; background-color: #5D7B9D;"> 
                                    <asp:Label ID="lblFotoAdicionadas" ForeColor="White" Font-Bold="true" runat="server" Text="Fotos Adicionadas" CssClass="lbl" />
                            </div>
                            <div style="float: left; height: auto; width:100%; margin:0px 0px 0px 0px;">
                                
                                    <asp:Repeater ID="rptFotos" runat="server" OnItemCommand="rptFotos_ItemCommand">
                                        <ItemTemplate>
                                            <div style="float: left; height: auto; margin-right:20px;"> 
                                                <div style="float: left; height: auto; margin:0px 0px 0px 0px;">
                                                    <asp:RadioButton ID="rdBtn" runat="server" Text="Capa" Checked='<%# Eval("eCapa") %>' AutoPostBack="true" OnCheckedChanged="OnCheckedChanged_Click" GroupName="capa" ToolTip='<%# Eval("ids")  %>' />
                                                </div>
                                                <div style="float: left; height: auto; margin:0px 0px 0px 0px;">
                                                    <asp:ImageButton ID="btnExcluirFoto" runat="server" ImageUrl="~/img/icon_remove.png" CommandArgument='<%# Eval("ID")  %>' CommandName="cmdExcluir" />
                                                </div>
                                                <br clear="all" />
                                                <div style="float: left; height: auto; margin:0px 0px 0px 0px;"> 
                                                    <asp:Image ID="Image1" runat="server" Width="160px" Height="78px" ImageUrl='<%# Eval("URL")  %>'  />
                                                </div>
                                            </div>
                                        </ItemTemplate>
                                    </asp:Repeater>
                                
                            </div>
                        </div>


                        <br clear="all" />
                        <div style="float: left; height: auto; width:100%; margin:30px 0px 10px 0px;">
                            <asp:Button ID="btnSalvar" runat="server" Text="Salvar" CssClass="btn primary" OnClick="btnSalvar_Click" />
                            <asp:Button ID="btnLimpar" runat="server" Text="Limpar" CssClass="btn close" OnClick="btnLimpar_Click"/>
                            <asp:Button ID="btnVoltar" runat="server" Text="Voltar" CssClass="btn info"  OnClick="btnVoltar_Click"/>
                        </div>
                    </asp:Panel>
                </asp:View>

            </asp:MultiView>

        </div>
        </ContentTemplate>

          <Triggers>
            <asp:PostBackTrigger ControlID="btnADDFoto" />
        </Triggers>

    </asp:UpdatePanel>

</asp:Content>
